Skip to content

fix: wait for branch checks before merging preview PRs - #10

Merged
patrickleet merged 2 commits into
mainfrom
fix-preview-promotion-title
Nov 19, 2026
Merged

patrickleet merged 2 commits into
mainfrom
fix-preview-promotion-title

Conversation

@patrickleet

Copy link
Copy Markdown
Contributor

Preview promotion and cleanup open GitOps PRs and try to squash-merge them immediately. When the environment repository requires CI, GitHub can refuse that first attempt while checks are still starting. A promotion rerun also skips an open PR when rendering produces the same manifest.

Both preview workflows now retry GitHub's branch-policy refusal for up to five minutes, using the exact environment commit as a merge precondition. They stop if the PR closes, its head changes, or GitHub returns another error. A promotion rerun looks for an existing open PR even when there is no new commit. The jobs use the repository's normal merge rules and existing token permissions.

Use semantic titles with the source repository and PR number for newly opened preview and cleanup PRs. The existing GitOps commit subjects and source PR URL are preserved, including the GitHub backlink from the deployment commit.

Local validation covered immediate success, both observed branch-policy errors, concurrent merge, changed head, closed PR and authorization failure with a stubbed GitHub CLI. The four existing values-merge fixtures and ShellCheck passed. Actionlint passed with the existing shell findings and its unsupported job.workflow_sha context excluded.

@patrickleet
patrickleet temporarily deployed to on-pr-release-promotion-pr-merge November 19, 2026 22:52 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion-pr-merge November 19, 2026 22:52 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion November 19, 2026 22:52 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion-pr November 19, 2026 22:52 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-release-promotion November 19, 2026 22:52 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion November 19, 2026 22:52 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-release-promotion-pr November 19, 2026 22:52 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2ad8577b-06d8-493f-bcd3-0452f8323c19
Commits

Reviewing files that changed from the base of the PR and between b38c197 and 181de78.

Files selected for processing: 5

  • .github/workflows/argocd-promote-helm.yaml
  • .github/workflows/on-pr.yaml
  • .github/workflows/preview-cleanup.yaml
  • scripts/merge-promotion-pr.sh
  • tests/test_merge_promotion_pr.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Dry Run: Release (Promotion)

Workflow validation completed successfully.

Settings

Setting Value
Environment Repository hops-ops/test-gitops
Project test-project
Application Name test-project-workflows-gitops
Output File environment/.gitops/deploy/helm/templates/workflows-gitops.yaml
Type Release
Method Promotion

Completed

  • Helm template generated for test-project-workflows-gitops
  • Changes detected: Yes

Skipped (dry run)

  • Commit to environment repository
  • Push to hops-ops/test-gitops
Environment Diff
diff --git a/.gitops/deploy/helm/templates/workflows-gitops.yaml b/.gitops/deploy/helm/templates/workflows-gitops.yaml
index 033c6b9..329a8bc 100644
--- a/.gitops/deploy/helm/templates/workflows-gitops.yaml
+++ b/.gitops/deploy/helm/templates/workflows-gitops.yaml
@@ -12,7 +12,7 @@ spec:
   source:
     path: .gitops/deploy/helm
     repoURL: https://github.com/hops-ops/workflows-gitops.git
-    targetRevision: v2.1.1
+    targetRevision: refs/pull/10/merge
     helm:
       version: v3
       values: |
@@ -20,7 +20,7 @@ spec:
           test: true
           type: release
           method: promotion
-          event: v-tag
+          event: pr
   destination:
     namespace: test-project
     server: https://kubernetes.default.svc
Generated Output File
---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: test-project-workflows-gitops
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: test-project
  source:
    path: .gitops/deploy/helm
    repoURL: https://github.com/hops-ops/workflows-gitops.git
    targetRevision: refs/pull/10/merge
    helm:
      version: v3
      values: |
        env:
          test: true
          type: release
          method: promotion
          event: pr
  destination:
    namespace: test-project
    server: https://kubernetes.default.svc
  syncPolicy:
    automated:
      selfHeal: true
      prune: true

This was a dry run. No changes were made to the environment repository.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Your preview environment has been published! 🚀

@github-actions

Copy link
Copy Markdown

Dry Run: Release (Promotion)

Workflow validation completed successfully.

Settings

Setting Value
Environment Repository hops-ops/test-gitops
Project test-project
Application Name test-project-workflows-gitops
Output File environment/.gitops/deploy/helm/templates/workflows-gitops.yaml
Type Release
Method Promotion

Completed

  • Helm template generated for test-project-workflows-gitops
  • Changes detected: Yes

Skipped (dry run)

  • Commit to environment repository
  • Push to hops-ops/test-gitops
Environment Diff
diff --git a/.gitops/deploy/helm/templates/workflows-gitops.yaml b/.gitops/deploy/helm/templates/workflows-gitops.yaml
index 033c6b9..329a8bc 100644
--- a/.gitops/deploy/helm/templates/workflows-gitops.yaml
+++ b/.gitops/deploy/helm/templates/workflows-gitops.yaml
@@ -12,7 +12,7 @@ spec:
   source:
     path: .gitops/deploy/helm
     repoURL: https://github.com/hops-ops/workflows-gitops.git
-    targetRevision: v2.1.1
+    targetRevision: refs/pull/10/merge
     helm:
       version: v3
       values: |
@@ -20,7 +20,7 @@ spec:
           test: true
           type: release
           method: promotion
-          event: v-tag
+          event: pr
   destination:
     namespace: test-project
     server: https://kubernetes.default.svc
Generated Output File
---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: test-project-workflows-gitops
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: test-project
  source:
    path: .gitops/deploy/helm
    repoURL: https://github.com/hops-ops/workflows-gitops.git
    targetRevision: refs/pull/10/merge
    helm:
      version: v3
      values: |
        env:
          test: true
          type: release
          method: promotion
          event: pr
  destination:
    namespace: test-project
    server: https://kubernetes.default.svc
  syncPolicy:
    automated:
      selfHeal: true
      prune: true

This was a dry run. No changes were made to the environment repository.

hops-gitops Bot pushed a commit to hops-ops/test-gitops that referenced this pull request Nov 19, 2026
@patrickleet
patrickleet temporarily deployed to on-push-preview-promotion November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-push-preview-promotion November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-push-release-promotion November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-push-preview-promotion-pr November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-push-release-promotion-pr November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion-pr-merge November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-release-promotion-pr-merge November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-release-promotion-pr November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion-pr November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-release-promotion November 19, 2026 22:55 — with GitHub Actions Inactive
@patrickleet
patrickleet temporarily deployed to on-pr-preview-promotion November 19, 2026 22:55 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Dry Run: Preview (Promotion PR)

Workflow validation completed successfully.

Settings

Setting Value
Environment Repository hops-ops/test-gitops
Project test-project
Application Name test-project-workflows-gitops-pr-10
Output File environment/.gitops/deploy/helm/templates/workflows-gitops-pr-10.yaml
Type Preview
Method Promotion PR

Completed

  • Helm template generated for test-project-workflows-gitops-pr-10
  • Changes detected: Yes

Skipped (dry run)

  • Commit to environment repository
  • Create PR in hops-ops/test-gitops
Environment Diff
diff --git a/.gitops/deploy/helm/templates/workflows-gitops-pr-10.yaml b/.gitops/deploy/helm/templates/workflows-gitops-pr-10.yaml
index 6c7719d..7e2cf1b 100644
--- a/.gitops/deploy/helm/templates/workflows-gitops-pr-10.yaml
+++ b/.gitops/deploy/helm/templates/workflows-gitops-pr-10.yaml
@@ -19,10 +19,10 @@ spec:
         env:
           test: true
           type: preview
-          method: promotion
+          method: promotion-pr
           event: pr
         image:
-          tag: pr-10-72a33a1ef95918d684cc3b80fcee29a312484889
+          tag: pr-10-181de78cd0ccbdd6df02a178b3a427257d5cc633
   destination:
     namespace: workflows-gitops-pr-10
     server: https://kubernetes.default.svc
Generated Output File
---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: test-project-workflows-gitops-pr-10
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: test-project
  source:
    path: .gitops/deploy/helm
    repoURL: https://github.com/hops-ops/workflows-gitops.git
    targetRevision: fix-preview-promotion-title
    helm:
      version: v3
      values: |
        env:
          test: true
          type: preview
          method: promotion-pr
          event: pr
        image:
          tag: pr-10-181de78cd0ccbdd6df02a178b3a427257d5cc633
  destination:
    namespace: workflows-gitops-pr-10
    server: https://kubernetes.default.svc
  syncPolicy:
    automated:
      selfHeal: true
      prune: true
---
# Source: promotion/templates/preview-resources.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: something
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: test-project
  source:
    path: .gitops/deploy/helm
    repoURL: https://github.com/unbounded-tech/something.git
    targetRevision: main
    helm:
      version: v3
  destination:
    namespace: workflows-gitops-pr-10
    server: https://kubernetes.default.svc
  syncPolicy:
    automated:
      selfHeal: true
      prune: true

This was a dry run. No changes were made to the environment repository.

hops-gitops Bot pushed a commit to hops-ops/test-gitops that referenced this pull request Nov 19, 2026
@github-actions

Copy link
Copy Markdown

Dry Run: Release (Promotion PR)

Workflow validation completed successfully.

Settings

Setting Value
Environment Repository hops-ops/test-gitops
Project test-project
Application Name test-project-workflows-gitops
Output File environment/.gitops/deploy/helm/templates/workflows-gitops.yaml
Type Release
Method Promotion PR

Completed

  • Helm template generated for test-project-workflows-gitops
  • Changes detected: Yes

Skipped (dry run)

  • Commit to environment repository
  • Create PR in hops-ops/test-gitops
Environment Diff
diff --git a/.gitops/deploy/helm/templates/workflows-gitops.yaml b/.gitops/deploy/helm/templates/workflows-gitops.yaml
index 033c6b9..374026a 100644
--- a/.gitops/deploy/helm/templates/workflows-gitops.yaml
+++ b/.gitops/deploy/helm/templates/workflows-gitops.yaml
@@ -12,15 +12,15 @@ spec:
   source:
     path: .gitops/deploy/helm
     repoURL: https://github.com/hops-ops/workflows-gitops.git
-    targetRevision: v2.1.1
+    targetRevision: refs/pull/10/merge
     helm:
       version: v3
       values: |
         env:
           test: true
           type: release
-          method: promotion
-          event: v-tag
+          method: promotion-pr-merge
+          event: pr
   destination:
     namespace: test-project
     server: https://kubernetes.default.svc
Generated Output File
---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: test-project-workflows-gitops
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: test-project
  source:
    path: .gitops/deploy/helm
    repoURL: https://github.com/hops-ops/workflows-gitops.git
    targetRevision: refs/pull/10/merge
    helm:
      version: v3
      values: |
        env:
          test: true
          type: release
          method: promotion-pr-merge
          event: pr
  destination:
    namespace: test-project
    server: https://kubernetes.default.svc
  syncPolicy:
    automated:
      selfHeal: true
      prune: true

This was a dry run. No changes were made to the environment repository.

@patrickleet
patrickleet merged commit 3ba3b89 into main Nov 19, 2026
14 checks passed

This branch was previously deployed

10 inactive deployments
on-pr-preview-promotion — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Preview Promotion / argocd-promote-helm #14
on-pr-release-promotion — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Release Promotion / argocd-promote-helm #14
on-pr-preview-promotion-pr — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Preview Promotion PR / argocd-promote-helm #14
on-pr-release-promotion-pr — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Release Promotion PR / argocd-promote-helm #14
on-pr-release-promotion-pr-merge — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Release Promotion PR + Merge / argocd-promote-helm #14
on-pr-preview-promotion-pr-merge — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Preview Promotion PR + Merge / argocd-promote-helm #14
on-push-preview-promotion — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Preview Promotion / argocd-promote-helm #14
on-push-release-promotion-pr — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Release Promotion PR / argocd-promote-helm #14
on-push-preview-promotion-pr — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Preview Promotion PR / argocd-promote-helm #14
on-push-release-promotion — 181de78c Deployed Nov 19, 2026 by patrickleet via Dry Run - Release Promotion / argocd-promote-helm #14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant